<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>蓝源Eloan-P2P平台(系统管理平台)</title>
<#include "../common/header.ftl"/>
    <script type="text/javascript" src="/js/plugins/jquery.form.js"></script>
    <script type="text/javascript" src="/js/plugins/jquery.twbsPagination.min.js"></script>
    <script type="text/javascript" src="/js/plugins-override.js"></script>
    <script type="text/javascript" src="/js/My97DatePicker/WdatePicker.js" ></script>

    <script>
        // 页面加载完毕执行
        $(function () {

            $('#pagination').twbsPagination({
                totalPages : ${pageInfo.pages} || 1,
                    startPage : ${pageInfo.pageNum} || 1,
                    visiblePages : 5,
                    initiateStartPageClick:false,
                    onPageClick : function(event, page) {
                $("#currentPage").val(page);
                $("#searchForm").submit();
            }
        });

            $("#reload").click(function () {

                var ret = confirm("重新加载权限耗时较长,确定加载么?");

                if (ret){
                    // ajax请求
                    $.get("/permission/load", function (data) {
                        console.log(data);
                        if (data.success){
                            alert("加载成功");
                            window.location.reload();
                        } else {
                            alert("加载失败");
                        }
                    })
                }
            })
        })

    </script>

</head>
<body>
<!--左侧菜单回显变量设置-->
<#assign currentMenu = "permission_list">
<div class="container">
		<#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
					<#include "../common/menu.ftl" />
        </div>
        <div class="col-sm-9">
            <div class="page-header">
                <h3>权限管理</h3>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/permission/list" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <a href="javascript:; " id="reload" class="btn btn-success"><span class="glyphicon glyphicon-plus"></span>重新加载权限</a>
            </form>

            <table class="table table-striped table-hover" >
                <thead>
                    <tr>
                        <th>权限序号</th>
                        <th>权限名称</th>
                        <th>权限表达式</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <#list pageInfo.list as info>
                   <tr>
                       <td>${info_index + 1}</td>
                       <td>${info.name}</td>
                       <td>${info.expression}</td>
                       <td>
                           <a href="/permission/delete?id=${info.id}" class="btn btn-danger btn-xs" >
                               <span class="glyphicon glyphicon-trash"></span> 删除
                           </a>
                       </td>
                   </tr>
                </#list>
            </table>
            <div style="text-align: center;">
                <ul id="pagination" class="pagination"></ul>
            </div>
        </div>
    </div>
</div>
</body>
</html>